﻿<UserControl x:Class="OpenTKLightingTool.Controls.LightsList"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:ctrl="clr-namespace:OpenTKLightingTool.Controls"                                    
             mc:Ignorable="d" 
             d:DesignHeight="500" d:DesignWidth="380">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        
        <DataGrid x:Name="uxLights" Grid.Row="0" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserResizeColumns="False"
                            CanUserResizeRows="False" CanUserSortColumns="False"  >
            <DataGrid.Columns>
                <DataGridTemplateColumn Header="Visible" Width="Auto" IsReadOnly="True">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox IsChecked="{Binding Path=Visible, UpdateSourceTrigger=PropertyChanged}" Content="{x:Null}" Tag="{Binding Path=Index}" HorizontalAlignment="Center">
                                <CheckBox.Resources>
                                    <Style TargetType="{x:Type CheckBox}">
                                        <EventSetter Event="Checked" Handler="Checkbox_Checked" />
                                        <EventSetter Event="Unchecked" Handler="Checkbox_Unchecked" />
                                    </Style>
                                </CheckBox.Resources>
                            </CheckBox>                            
                        </DataTemplate>                        
                    </DataGridTemplateColumn.CellTemplate>                    
                </DataGridTemplateColumn>
                <DataGridTextColumn Header="Light Title" Width="*" Binding="{Binding Path=Title}" IsReadOnly="True" />                
            </DataGrid.Columns>
            <DataGrid.Resources>
                <Style TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource {x:Type DataGridCell}}" >
                    <Setter Property="Background" Value="White" />
                    <Style.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="BorderBrush" Value="Black" />
                            <Setter Property="Background" Value="OrangeRed"  />
                            <Setter Property="Foreground" Value="Yellow"  />
                            <Setter Property="FontWeight" Value="Bold" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </DataGrid.Resources>
        </DataGrid>
        
        <GroupBox Header="Properties" Grid.Row="1">
            <ctrl:LightProperties x:Name="uxProperties" />
        </GroupBox>       
    </Grid>
</UserControl>
